{"ast":null,"code":"var _jsxFileName = \"/data/messenger.client/src/components/Modal/index.tsx\",\n  _s = $RefreshSig$();\nimport React from 'react';\nimport ReactDOM from \"react-dom\";\nimport \"./Modal.scss\";\nimport { Button } from \"../index\";\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\nimport { Fragment as _Fragment } from \"react/jsx-dev-runtime\";\nconst Modal = _ref => {\n  _s();\n  let {\n    active,\n    title,\n    hasFunctionButtons = false,\n    onSubmit,\n    onClose,\n    customClassNameButtonFirst = '',\n    customClassNameButtonSecond = '',\n    children\n  } = _ref;\n  const [classNameButtonFirst] = React.useState(`modal__button ${customClassNameButtonFirst}`);\n  const [classNameButtonSecond] = React.useState(`modal__button ${customClassNameButtonSecond}`);\n  if (active) {\n    const portalElement = document.getElementById('root');\n    if (portalElement) {\n      return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/_jsxDEV(\"div\", {\n        className: \"modal\",\n        onClick: onClose,\n        children: /*#__PURE__*/_jsxDEV(\"div\", {\n          className: \"modal__content\",\n          onClick: event => event.stopPropagation(),\n          children: [/*#__PURE__*/_jsxDEV(\"div\", {\n            className: \"modal__header\",\n            children: /*#__PURE__*/_jsxDEV(\"div\", {\n              className: \"modal__title\",\n              children: title\n            }, void 0, false, {\n              fileName: _jsxFileName,\n              lineNumber: 28,\n              columnNumber: 29\n            }, this)\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 27,\n            columnNumber: 25\n          }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n            className: \"modal__body\",\n            children: children\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 30,\n            columnNumber: 25\n          }, this), hasFunctionButtons && /*#__PURE__*/_jsxDEV(\"div\", {\n            className: \"modal__footer\",\n            children: [/*#__PURE__*/_jsxDEV(Button, {\n              fullWidth: false,\n              text: 'Отмена',\n              customClassName: classNameButtonFirst,\n              callback: onClose\n            }, void 0, false, {\n              fileName: _jsxFileName,\n              lineNumber: 33,\n              columnNumber: 33\n            }, this), /*#__PURE__*/_jsxDEV(Button, {\n              fullWidth: false,\n              text: 'Подтвердить',\n              customClassName: classNameButtonSecond,\n              callback: onSubmit\n            }, void 0, false, {\n              fileName: _jsxFileName,\n              lineNumber: 39,\n              columnNumber: 33\n            }, this)]\n          }, void 0, true, {\n            fileName: _jsxFileName,\n            lineNumber: 32,\n            columnNumber: 29\n          }, this)]\n        }, void 0, true, {\n          fileName: _jsxFileName,\n          lineNumber: 26,\n          columnNumber: 21\n        }, this)\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 25,\n        columnNumber: 17\n      }, this), portalElement);\n    } else {\n      return /*#__PURE__*/_jsxDEV(_Fragment, {}, void 0, false);\n    }\n  } else {\n    return /*#__PURE__*/_jsxDEV(_Fragment, {}, void 0, false);\n  }\n};\n_s(Modal, \"pdI3qXzrCuFPYzo4enOn4usT9Qs=\");\n_c = Modal;\nexport default Modal;\nvar _c;\n$RefreshReg$(_c, \"Modal\");","map":{"version":3,"names":["React","ReactDOM","Button","Modal","active","title","hasFunctionButtons","onSubmit","onClose","customClassNameButtonFirst","customClassNameButtonSecond","children","classNameButtonFirst","useState","classNameButtonSecond","portalElement","document","getElementById","createPortal","event","stopPropagation"],"sources":["/data/messenger.client/src/components/Modal/index.tsx"],"sourcesContent":["import React from 'react';\nimport ReactDOM from \"react-dom\";\nimport {IModalProps} from \"../../models/props/IModalProps\";\nimport \"./Modal.scss\";\nimport {Button} from \"../index\";\n\nconst Modal: React.FC <React.PropsWithChildren<IModalProps>> = (\n    {\n        active,\n        title,\n        hasFunctionButtons = false,\n        onSubmit,\n        onClose,\n        customClassNameButtonFirst = '',\n        customClassNameButtonSecond = '',\n        children\n    }) => {\n    const [classNameButtonFirst] = React.useState<string>(`modal__button ${customClassNameButtonFirst}`);\n    const [classNameButtonSecond] = React.useState<string>(`modal__button ${customClassNameButtonSecond}`);\n    if (active) {\n        const portalElement = document.getElementById('root');\n\n        if (portalElement) {\n            return ReactDOM.createPortal(\n                <div className=\"modal\" onClick={onClose}>\n                    <div className=\"modal__content\" onClick={event => event.stopPropagation()}>\n                        <div className=\"modal__header\">\n                            <div className=\"modal__title\">{title}</div>\n                        </div>\n                        <div className=\"modal__body\">{children}</div>\n                        {(hasFunctionButtons &&\n                            <div className=\"modal__footer\">\n                                <Button\n                                    fullWidth={false}\n                                    text={'Отмена'}\n                                    customClassName={classNameButtonFirst}\n                                    callback={onClose}\n                                />\n                                <Button\n                                    fullWidth={false}\n                                    text={'Подтвердить'}\n                                    customClassName={classNameButtonSecond}\n                                    callback={onSubmit}\n                                />\n                            </div>\n                        )}\n                    </div>\n                </div>,\n                portalElement\n            );\n        }\n        else {\n            return (<></>);\n        }\n    } else {\n        return (<></>);\n    }\n}\n\nexport default Modal;\n"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,QAAQ,MAAM,WAAW;AAEhC,OAAO,cAAc;AACrB,SAAQC,MAAM,QAAO,UAAU;AAAC;AAAA;AAEhC,MAAMC,KAAsD,GAAG,QAUrD;EAAA;EAAA,IATN;IACIC,MAAM;IACNC,KAAK;IACLC,kBAAkB,GAAG,KAAK;IAC1BC,QAAQ;IACRC,OAAO;IACPC,0BAA0B,GAAG,EAAE;IAC/BC,2BAA2B,GAAG,EAAE;IAChCC;EACJ,CAAC;EACD,MAAM,CAACC,oBAAoB,CAAC,GAAGZ,KAAK,CAACa,QAAQ,CAAU,iBAAgBJ,0BAA2B,EAAC,CAAC;EACpG,MAAM,CAACK,qBAAqB,CAAC,GAAGd,KAAK,CAACa,QAAQ,CAAU,iBAAgBH,2BAA4B,EAAC,CAAC;EACtG,IAAIN,MAAM,EAAE;IACR,MAAMW,aAAa,GAAGC,QAAQ,CAACC,cAAc,CAAC,MAAM,CAAC;IAErD,IAAIF,aAAa,EAAE;MACf,oBAAOd,QAAQ,CAACiB,YAAY,eACxB;QAAK,SAAS,EAAC,OAAO;QAAC,OAAO,EAAEV,OAAQ;QAAA,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